package com.wdj.creation.simplefactory.factory;

import com.wdj.creation.simplefactory.entity.AppleProduct;
import com.wdj.creation.simplefactory.entity.BananaProduct;
import com.wdj.creation.simplefactory.entity.Product;

/**
 * @ClassName SimpleFactory
 * @Description
 * @Author wdj
 * @Date 2020/8/9 15:40
 * @Version 1.0
 **/
public class SimpleFactory {
    public Product getProduct(String productName){
        if (productName.equalsIgnoreCase("apple")){
            return  new AppleProduct();
        }else if(productName.equalsIgnoreCase("banana")){
            return new BananaProduct();
        }else {
            return new AppleProduct();
        }


    }
}
